package mapper.sys;

import java.util.List;
import java.util.Map;

import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;

import com.common.BaseMapper;

public interface VUserFunMapper<T> extends BaseMapper<T> {
	
	/**
	 * 获取权限
	 */
	@Select("select * from v_userfun WHERE userid=#{un} GROUP BY id ORDER BY sort ")
	@Results({
		@Result(id=true,property="id",column="id",javaType=String.class),
		@Result(property="title",column="title",javaType=String.class),
		@Result(property="linkurl",column="linkurl",javaType=String.class),
		@Result(property="pid",column="pid",javaType=String.class),
		@Result(property="bigurl",column="bigurl",javaType=String.class),
		@Result(property="iconurl",column="iconurl",javaType=String.class),
		@Result(property="userid",column="userid",javaType=String.class),
		@Result(property="iconCls",column="iconCls",javaType=String.class),
		@Result(property="sort",column="sort",javaType=String.class),
		@Result(property="target",column="target",javaType=String.class)
	})
	public List<Map> getByUserid(@Param("un")String userid);
	
	List<Map> getByPid(@Param("pid")String pid, @Param("title")String title, @Param("linkurl")String linkurl);
	
	@Select("select * from sys_fun ORDER BY sort ")
	@Results({
		@Result(id=true,property="id",column="id",javaType=String.class),
		@Result(property="title",column="title",javaType=String.class),
		@Result(property="linkurl",column="linkurl",javaType=String.class),
		@Result(property="pid",column="pid",javaType=String.class),
		@Result(property="bigurl",column="bigurl",javaType=String.class),
		@Result(property="iconurl",column="iconurl",javaType=String.class),
		@Result(property="iconCls",column="iconCls",javaType=String.class),
		@Result(property="sort",column="sort",javaType=Integer.class),
		@Result(property="target",column="target",javaType=String.class)
	})
	public List<Map> getAll();
}
